package com.wangyanan.controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * RequestBody接收JSON格式的数据
 *
 * @author 王亚楠
 * @date 2018年06月05日 16:59
 **/
@RestController
@RequestMapping("test")
public class TestJsonController {

    @RequestMapping("string")
    public String test(@RequestBody String data) {
        System.out.println(data);
        return data;
    }

    @RequestMapping("map")
    public String test(@RequestBody Map<String, Object> data) {
        return data.toString();
    }
}
